﻿<span style='font-size:11px; color:#000000; background:#ffffff; '><pre>
<span style='color:#800000; font-weight:bold; '>Protected</span> <span style='color:#800000; font-weight:bold; '>Sub</span> createPdfButton_Click<span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>ByVal</span> sender <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>Object</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>ByVal</span> e <span style='color:#800000; font-weight:bold; '>As</span> EventArgs<span style='color:#808030; '>)</span>
    <span style='color:#696969; '>' Create a PDF document</span>
    <span style='color:#800000; font-weight:bold; '>Dim</span> pdfDocument <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>New</span> Document<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>

    <span style='color:#696969; '>' Set license key received after purchase to use the converter in licensed mode</span>
    <span style='color:#696969; '>' Leave it not set to use the converter in demo mode</span>
    pdfDocument<span style='color:#008c00; '>.</span>LicenseKey <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"4W9+bn19bn5ue2B+bn1/YH98YHd3d3c="</span>

    <span style='color:#696969; '>' Add a page to PDF document</span>
    <span style='color:#800000; font-weight:bold; '>Dim</span> pdfPage <span style='color:#800000; font-weight:bold; '>As</span> PdfPage <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span>AddPage<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>

    <span style='color:#800000; font-weight:bold; '>Try</span>
        <span style='color:#696969; '>' The font used for titles in PDF document</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> titlesFont <span style='color:#800000; font-weight:bold; '>As</span> PdfFont <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span>AddFont<span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>New</span> Font<span style='color:#808030; '>(</span><span style='color:#0000e6; '>"Times New Roman"</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> FontStyle<span style='color:#008c00; '>.</span>Bold<span style='color:#808030; '>,</span> GraphicsUnit<span style='color:#008c00; '>.</span>Point<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' The font used for field names in PDF document</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> fieldNameFont <span style='color:#800000; font-weight:bold; '>As</span> PdfFont <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span>AddFont<span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>New</span> Font<span style='color:#808030; '>(</span><span style='color:#0000e6; '>"Times New Roman"</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> FontStyle<span style='color:#008c00; '>.</span>Regular<span style='color:#808030; '>,</span> GraphicsUnit<span style='color:#008c00; '>.</span>Point<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' The font used for buttons text in PDF document</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> buttonTextFont <span style='color:#800000; font-weight:bold; '>As</span> PdfFont <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span>AddFont<span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>New</span> Font<span style='color:#808030; '>(</span><span style='color:#0000e6; '>"Times New Roman"</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> FontStyle<span style='color:#008c00; '>.</span>Regular<span style='color:#808030; '>,</span> GraphicsUnit<span style='color:#008c00; '>.</span>Point<span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' The font used for PDF form text box fields</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> textFieldFont <span style='color:#800000; font-weight:bold; '>As</span> PdfFont <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span>AddFont<span style='color:#808030; '>(</span>StdFontBaseFamily<span style='color:#008c00; '>.</span>Helvetica<span style='color:#808030; '>)</span>
        textFieldFont<span style='color:#008c00; '>.</span>Size <span style='color:#808030; '>=</span> <span style='color:#008c00; '>8</span>
        <span style='color:#696969; '>' The font used for PDF form combo box fields</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> comboBoxFieldFont <span style='color:#800000; font-weight:bold; '>As</span> PdfFont <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span>AddFont<span style='color:#808030; '>(</span>StdFontBaseFamily<span style='color:#008c00; '>.</span>Helvetica<span style='color:#808030; '>)</span>
        comboBoxFieldFont<span style='color:#008c00; '>.</span>Size <span style='color:#808030; '>=</span> <span style='color:#008c00; '>8</span>

        <span style='color:#800000; font-weight:bold; '>Dim</span> xLocation <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>Single</span> <span style='color:#808030; '>=</span> <span style='color:#008c00; '>5</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> yLocation <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>Single</span> <span style='color:#808030; '>=</span> <span style='color:#008c00; '>5</span>

        <span style='color:#696969; '>' Add document title</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> titleTextElement <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Create PDF Forms"</span><span style='color:#808030; '>,</span> titlesFont<span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> addElementResult <span style='color:#800000; font-weight:bold; '>As</span> AddElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>titleTextElement<span style='color:#808030; '>)</span>

        yLocation <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds<span style='color:#008c00; '>.</span>Bottom <span style='color:#808030; '>+</span> <span style='color:#008c00; '>15</span>

        <span style='color:#696969; '>' Add a text box field to PDF form</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> fieldNameTextElement <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"First name:"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        addElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> fieldNameRectangle <span style='color:#800000; font-weight:bold; '>As</span> RectangleF <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds
        <span style='color:#800000; font-weight:bold; '>Dim</span> fieldBoundingRectangle <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>150</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>15</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Create the form field</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> textBoxField <span style='color:#800000; font-weight:bold; '>As</span> PdfFormTextBox <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddTextBox<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Enter First Name"</span><span style='color:#808030; '>,</span> textFieldFont<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        textBoxField<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"firstName"</span>
        <span style='color:#696969; '>' Set the form field default value</span>
        textBoxField<span style='color:#008c00; '>.</span>DefaultValue <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"A default first name"</span>
        <span style='color:#696969; '>' Set form field style </span>
        textBoxField<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>AliceBlue

        yLocation <span style='color:#808030; '>=</span> fieldNameRectangle<span style='color:#008c00; '>.</span>Bottom <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span>

        <span style='color:#696969; '>' Add a text box field to PDF form</span>
        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Last name:"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        addElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>
        fieldNameRectangle <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds
        fieldBoundingRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>150</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>15</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Create the form field</span>
        textBoxField <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddTextBox<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Enter Last Name"</span><span style='color:#808030; '>,</span> textFieldFont<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        textBoxField<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"lastName"</span>
        <span style='color:#696969; '>' Set the form field default value</span>
        textBoxField<span style='color:#008c00; '>.</span>DefaultValue <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"A default last name"</span>
        <span style='color:#696969; '>' Set form field style </span>
        textBoxField<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>MistyRose

        yLocation <span style='color:#808030; '>=</span> fieldNameRectangle<span style='color:#008c00; '>.</span>Bottom <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span>

        <span style='color:#696969; '>' Add a password text box field to PDF form</span>
        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Password:"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        addElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>
        fieldNameRectangle <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds
        fieldBoundingRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>150</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>15</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Create the form field</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> passwordTextBoxField <span style='color:#800000; font-weight:bold; '>As</span> PdfFormTextBox <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddTextBox<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>""</span><span style='color:#808030; '>,</span> textFieldFont<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        passwordTextBoxField<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"password"</span>
        <span style='color:#696969; '>' Set form field style </span>
        passwordTextBoxField<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>AliceBlue
        <span style='color:#696969; '>' Set the password mode for the text box</span>
        passwordTextBoxField<span style='color:#008c00; '>.</span>IsPassword <span style='color:#808030; '>=</span> <span style='color:#0f4d75; '>True</span>

        yLocation <span style='color:#808030; '>=</span> fieldNameRectangle<span style='color:#008c00; '>.</span>Bottom <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span>

        <span style='color:#696969; '>' Add a radio buttons group to PDF form</span>
        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Gender:"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        addElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>
        fieldNameRectangle <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds
        <span style='color:#696969; '>' Create the radio buttons group</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> radioButtonsGroup <span style='color:#800000; font-weight:bold; '>As</span> PdfFormRadioButtonsGroup <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddRadioButtonsGroup<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        radioButtonsGroup<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"gender"</span>
        <span style='color:#696969; '>' Set style of the radio buttons in this group</span>
        radioButtonsGroup<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>AntiqueWhite

        <span style='color:#696969; '>' Add the first radio button to group</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> radioButtonRectangle <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>50</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Create the form field</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> radioButtonField <span style='color:#800000; font-weight:bold; '>As</span> PdfFormRadioButton <span style='color:#808030; '>=</span> radioButtonsGroup<span style='color:#008c00; '>.</span>AddRadioButton<span style='color:#808030; '>(</span>radioButtonRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"male"</span><span style='color:#808030; '>,</span> pdfPage<span style='color:#808030; '>)</span>

        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>22</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>30</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Male"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>

        <span style='color:#696969; '>' Add the second radio button to group</span>
        radioButtonRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>50</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Create the form field</span>
        radioButtonField <span style='color:#808030; '>=</span> radioButtonsGroup<span style='color:#008c00; '>.</span>AddRadioButton<span style='color:#808030; '>(</span>radioButtonRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"female"</span><span style='color:#808030; '>,</span> pdfPage<span style='color:#808030; '>)</span>

        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>72</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>30</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Female"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>

        <span style='color:#696969; '>' Set the selected radio btton in group</span>
        radioButtonsGroup<span style='color:#008c00; '>.</span>SetCheckedRadioButton<span style='color:#808030; '>(</span><span style='color:#0000e6; '>"male"</span><span style='color:#808030; '>)</span>

        yLocation <span style='color:#808030; '>=</span> fieldNameRectangle<span style='color:#008c00; '>.</span>Bottom <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span>

        <span style='color:#696969; '>' Add a checkbox field to PDF form</span>
        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Vehicle:"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        addElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>
        fieldNameRectangle <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds
        fieldBoundingRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Create the form field</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> checkBoxField <span style='color:#800000; font-weight:bold; '>As</span> PdfFormCheckBox <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddCheckBox<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        checkBoxField<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"haveCar"</span>
        <span style='color:#696969; '>' Set form field style </span>
        checkBoxField<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>AntiqueWhite
        <span style='color:#696969; '>' Set checkbox field checked state</span>
        checkBoxField<span style='color:#008c00; '>.</span>Checked <span style='color:#808030; '>=</span> <span style='color:#0f4d75; '>True</span>

        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>22</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>50</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"I have a car"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>

        yLocation <span style='color:#808030; '>=</span> fieldNameRectangle<span style='color:#008c00; '>.</span>Bottom <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span>

        <span style='color:#696969; '>' Add a combo box list field to PDF form</span>
        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Vehicle Type:"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        addElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>
        fieldNameRectangle <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds
        fieldBoundingRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>50</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>15</span><span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> comboBoxItems<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>String</span> <span style='color:#808030; '>=</span> {<span style='color:#0000e6; '>"Volvo"</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Saab"</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Audi"</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Opel"</span>}
        <span style='color:#696969; '>' Create the form field</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> comboBoxField <span style='color:#800000; font-weight:bold; '>As</span> PdfFormComboBox <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddComboBox<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>,</span> comboBoxItems<span style='color:#808030; '>,</span> comboBoxFieldFont<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        comboBoxField<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"vehicleType"</span>
        <span style='color:#696969; '>' Set the form field default value</span>
        comboBoxField<span style='color:#008c00; '>.</span>DefaultValue <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"Audi"</span>
        <span style='color:#696969; '>' Set form field style </span>
        comboBoxField<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>LightCyan
        <span style='color:#696969; '>' Set selected item in combo box</span>
        comboBoxField<span style='color:#008c00; '>.</span>Value <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"Audi"</span>

        yLocation <span style='color:#808030; '>=</span> fieldNameRectangle<span style='color:#008c00; '>.</span>Bottom <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span>

        <span style='color:#696969; '>' Add a multiline text box field to PDF form</span>
        fieldNameTextElement <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> TextElement<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation <span style='color:#808030; '>+</span> <span style='color:#008c00; '>20</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Comments:"</span><span style='color:#808030; '>,</span> fieldNameFont<span style='color:#808030; '>)</span>
        addElementResult <span style='color:#808030; '>=</span> pdfPage<span style='color:#008c00; '>.</span>AddElement<span style='color:#808030; '>(</span>fieldNameTextElement<span style='color:#808030; '>)</span>
        fieldNameRectangle <span style='color:#808030; '>=</span> addElementResult<span style='color:#008c00; '>.</span>EndPageBounds
        fieldBoundingRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>fieldNameRectangle<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Right</span> <span style='color:#808030; '>+</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>150</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>60</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Create the form field</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> multilineTextBoxField <span style='color:#800000; font-weight:bold; '>As</span> PdfFormTextBox <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddTextBox<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Enter your comments here:"</span> <span style='color:#808030; '>&amp;</span> vbCrLf <span style='color:#808030; '>&amp;</span> <span style='color:#0000e6; '>"First comment line"</span> <span style='color:#808030; '>&amp;</span> vbCrLf <span style='color:#808030; '>&amp;</span> <span style='color:#0000e6; '>"Second comment line"</span><span style='color:#808030; '>,</span> textFieldFont<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        multilineTextBoxField<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"comments"</span>
        <span style='color:#696969; '>' Set form field style </span>
        multilineTextBoxField<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>AliceBlue
        <span style='color:#696969; '>' Set the multiline mode for text box field</span>
        multilineTextBoxField<span style='color:#008c00; '>.</span>IsMultiLine <span style='color:#808030; '>=</span> <span style='color:#0f4d75; '>True</span>

        yLocation <span style='color:#808030; '>=</span> yLocation <span style='color:#808030; '>+</span> <span style='color:#008c00; '>70</span>

        <span style='color:#696969; '>' Add a form submit button to PDF form</span>
        fieldBoundingRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>xLocation<span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>75</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>15</span><span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> submitFormButton <span style='color:#800000; font-weight:bold; '>As</span> PdfFormButton <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddButton<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Submit"</span><span style='color:#808030; '>,</span> buttonTextFont<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        submitFormButton<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"submitFormButton"</span>
        <span style='color:#696969; '>' Set form field style </span>
        submitFormButton<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>Beige
        <span style='color:#696969; '>' Create the form submit action</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> submitFormAction <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>New</span> PdfSubmitFormAction<span style='color:#808030; '>(</span>submitUrlTextBox<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Text</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Form values will be submitted in HTML form format</span>
        submitFormAction<span style='color:#008c00; '>.</span>Flags <span style='color:#808030; '>=</span> submitFormAction<span style='color:#008c00; '>.</span>Flags <span style='color:#800000; font-weight:bold; '>Or</span> PdfFormSubmitFlags<span style='color:#008c00; '>.</span>ExportFormat
        <span style='color:#800000; font-weight:bold; '>If</span> getMethodRadioButton<span style='color:#008c00; '>.</span>Checked <span style='color:#800000; font-weight:bold; '>Then</span>
            submitFormAction<span style='color:#008c00; '>.</span>Flags <span style='color:#808030; '>=</span> submitFormAction<span style='color:#008c00; '>.</span>Flags <span style='color:#800000; font-weight:bold; '>Or</span> PdfFormSubmitFlags<span style='color:#008c00; '>.</span>GetMethod
        <span style='color:#800000; font-weight:bold; '>End</span> <span style='color:#800000; font-weight:bold; '>If</span>
        <span style='color:#696969; '>' Set the form submit button action</span>
        submitFormButton<span style='color:#008c00; '>.</span>Action <span style='color:#808030; '>=</span> submitFormAction

        <span style='color:#696969; '>' Add a form reset button to PDF form</span>
        fieldBoundingRectangle <span style='color:#808030; '>=</span> <span style='color:#800000; font-weight:bold; '>New</span> RectangleF<span style='color:#808030; '>(</span>xLocation <span style='color:#808030; '>+</span> <span style='color:#008c00; '>100</span><span style='color:#808030; '>,</span> yLocation<span style='color:#808030; '>,</span> <span style='color:#008c00; '>75</span><span style='color:#808030; '>,</span> <span style='color:#008c00; '>15</span><span style='color:#808030; '>)</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> resetFormButton <span style='color:#800000; font-weight:bold; '>As</span> PdfFormButton <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Form</span><span style='color:#008c00; '>.</span>AddButton<span style='color:#808030; '>(</span>pdfPage<span style='color:#808030; '>,</span> fieldBoundingRectangle<span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"Reset"</span><span style='color:#808030; '>,</span> buttonTextFont<span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set unique form field name used when the form is submitted</span>
        resetFormButton<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Name</span> <span style='color:#808030; '>=</span> <span style='color:#0000e6; '>"resetFormButton"</span>
        <span style='color:#696969; '>' Set form field style </span>
        resetFormButton<span style='color:#008c00; '>.</span>Style<span style='color:#008c00; '>.</span>BackColor <span style='color:#808030; '>=</span> Color<span style='color:#008c00; '>.</span>Beige
        <span style='color:#696969; '>' Create the form reset action</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> resetFormAction <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>New</span> PdfResetFormAction<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>
        <span style='color:#696969; '>' Set the form reset button action</span>
        resetFormButton<span style='color:#008c00; '>.</span>Action <span style='color:#808030; '>=</span> resetFormAction

        <span style='color:#696969; '>' Save the PDF document in a memory buffer</span>
        <span style='color:#800000; font-weight:bold; '>Dim</span> outPdfBuffer<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#800000; font-weight:bold; '>As</span> <span style='color:#800000; font-weight:bold; '>Byte</span> <span style='color:#808030; '>=</span> pdfDocument<span style='color:#008c00; '>.</span>Save<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>

        <span style='color:#696969; '>' Send the PDF as response to browser</span>

        <span style='color:#696969; '>' Set response content type</span>
        Response<span style='color:#008c00; '>.</span>AddHeader<span style='color:#808030; '>(</span><span style='color:#0000e6; '>"Content-Type"</span><span style='color:#808030; '>,</span> <span style='color:#0000e6; '>"application/pdf"</span><span style='color:#808030; '>)</span>

        <span style='color:#696969; '>' Instruct the browser to open the PDF file as an attachment or inline</span>
        Response<span style='color:#008c00; '>.</span>AddHeader<span style='color:#808030; '>(</span><span style='color:#0000e6; '>"Content-Disposition"</span><span style='color:#808030; '>,</span> <span style='color:#800000; font-weight:bold; '>String</span><span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Format</span><span style='color:#808030; '>(</span><span style='color:#0000e6; '>"attachment; filename=Create_PDF_Forms.pdf; size={0}"</span><span style='color:#808030; '>,</span> outPdfBuffer<span style='color:#008c00; '>.</span>Length<span style='color:#008c00; '>.</span>ToString<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span><span style='color:#808030; '>)</span><span style='color:#808030; '>)</span>

        <span style='color:#696969; '>' Write the PDF document buffer to HTTP response</span>
        Response<span style='color:#008c00; '>.</span>BinaryWrite<span style='color:#808030; '>(</span>outPdfBuffer<span style='color:#808030; '>)</span>

        <span style='color:#696969; '>' End the HTTP response and stop the current page processing</span>
        Response<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>End</span><span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>Finally</span>
        <span style='color:#696969; '>' Close the PDF document</span>
        pdfDocument<span style='color:#008c00; '>.</span><span style='color:#800000; font-weight:bold; '>Close</span><span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>End</span> <span style='color:#800000; font-weight:bold; '>Try</span>
<span style='color:#800000; font-weight:bold; '>End</span> <span style='color:#800000; font-weight:bold; '>Sub</span>
</pre>
</span>